<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>YDLIDAR SDK: serial::Serial Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="ydliar.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">YDLIDAR SDK
   &#160;<span id="projectnumber">V1.4.5</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceserial.html">serial</a></li><li class="navelem"><a class="el" href="classserial_1_1_serial.html">Serial</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classserial_1_1_serial-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">serial::Serial Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="serial_8h_source.html">serial.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial_1_1_scoped_read_lock.html">ScopedReadLock</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial_1_1_scoped_write_lock.html">ScopedWriteLock</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial_1_1_serial_impl.html">SerialImpl</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aecbc4cc1723143805ae5a4aa79ba9332"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#aecbc4cc1723143805ae5a4aa79ba9332">Serial</a> (const std::string &amp;port=&quot;&quot;, uint32_t baudrate=9600, <a class="el" href="structserial_1_1_timeout.html">Timeout</a> timeout=<a class="el" href="structserial_1_1_timeout.html">Timeout</a>(), <a class="el" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a> bytesize=eightbits, <a class="el" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a> parity=parity_none, <a class="el" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a> stopbits=stopbits_one, <a class="el" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a> flowcontrol=flowcontrol_none)</td></tr>
<tr class="separator:aecbc4cc1723143805ae5a4aa79ba9332"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a071000a2f5f77a40df8311fad5044481"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a071000a2f5f77a40df8311fad5044481">~Serial</a> ()</td></tr>
<tr class="separator:a071000a2f5f77a40df8311fad5044481"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa4403ddb51e9d209fd86ed316f0ee9b4"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#aa4403ddb51e9d209fd86ed316f0ee9b4">open</a> ()</td></tr>
<tr class="separator:aa4403ddb51e9d209fd86ed316f0ee9b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a657df1809f2eb966aec5811ed2c70b8c"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a657df1809f2eb966aec5811ed2c70b8c">isOpen</a> ()</td></tr>
<tr class="separator:a657df1809f2eb966aec5811ed2c70b8c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb659db0159a6f4bcefe760fa20df18e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#afb659db0159a6f4bcefe760fa20df18e">closePort</a> ()</td></tr>
<tr class="separator:afb659db0159a6f4bcefe760fa20df18e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab5fae6cebb8e34345ca1f55cbccc4698"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#ab5fae6cebb8e34345ca1f55cbccc4698">available</a> ()</td></tr>
<tr class="separator:ab5fae6cebb8e34345ca1f55cbccc4698"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a59bd8d40309769e8eed91dd3684e0000"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a59bd8d40309769e8eed91dd3684e0000">waitReadable</a> ()</td></tr>
<tr class="separator:a59bd8d40309769e8eed91dd3684e0000"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a35c0f6ff20c142a5210dde288731f954"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a35c0f6ff20c142a5210dde288731f954">waitByteTimes</a> (size_t count)</td></tr>
<tr class="separator:a35c0f6ff20c142a5210dde288731f954"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa94e4ca3b2b803e3145c99fe063ae09b"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#aa94e4ca3b2b803e3145c99fe063ae09b">waitfordata</a> (size_t data_count, uint32_t timeout, size_t *returned_size)</td></tr>
<tr class="memdesc:aa94e4ca3b2b803e3145c99fe063ae09b"><td class="mdescLeft">&#160;</td><td class="mdescRight">waitfordata  <a href="#aa94e4ca3b2b803e3145c99fe063ae09b">More...</a><br /></td></tr>
<tr class="separator:aa94e4ca3b2b803e3145c99fe063ae09b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeb637cc63ead4662317cea58a997e0f6"><td class="memItemLeft" align="right" valign="top">virtual size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#aeb637cc63ead4662317cea58a997e0f6">writeData</a> (const uint8_t *data, size_t size)</td></tr>
<tr class="memdesc:aeb637cc63ead4662317cea58a997e0f6"><td class="mdescLeft">&#160;</td><td class="mdescRight">writeData  <a href="#aeb637cc63ead4662317cea58a997e0f6">More...</a><br /></td></tr>
<tr class="separator:aeb637cc63ead4662317cea58a997e0f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a23af62642b1739cf31fb1c8a272074a1"><td class="memItemLeft" align="right" valign="top">virtual size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a23af62642b1739cf31fb1c8a272074a1">readData</a> (uint8_t *data, size_t size)</td></tr>
<tr class="memdesc:a23af62642b1739cf31fb1c8a272074a1"><td class="mdescLeft">&#160;</td><td class="mdescRight">readData  <a href="#a23af62642b1739cf31fb1c8a272074a1">More...</a><br /></td></tr>
<tr class="separator:a23af62642b1739cf31fb1c8a272074a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a01fc2e3d77cb7d70069de87eca1400e9"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a01fc2e3d77cb7d70069de87eca1400e9">read</a> (uint8_t *buffer, size_t size)</td></tr>
<tr class="separator:a01fc2e3d77cb7d70069de87eca1400e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3ecd4645c76548ba079eab6f2f46adfb"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a3ecd4645c76548ba079eab6f2f46adfb">read</a> (std::vector&lt; uint8_t &gt; &amp;buffer, size_t size=1)</td></tr>
<tr class="separator:a3ecd4645c76548ba079eab6f2f46adfb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad6c6637fdf8edd85c3a6a63d98fc18f7"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#ad6c6637fdf8edd85c3a6a63d98fc18f7">read</a> (std::string &amp;buffer, size_t size=1)</td></tr>
<tr class="separator:ad6c6637fdf8edd85c3a6a63d98fc18f7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa52fbf7d23fb761a46e2400829d2b77a"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#aa52fbf7d23fb761a46e2400829d2b77a">read</a> (size_t size=1)</td></tr>
<tr class="separator:aa52fbf7d23fb761a46e2400829d2b77a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a010b18ec545dfe1a7bb1c95be4bdaa54"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a010b18ec545dfe1a7bb1c95be4bdaa54">readline</a> (std::string &amp;buffer, size_t size=65536, std::string eol=&quot;\n&quot;)</td></tr>
<tr class="separator:a010b18ec545dfe1a7bb1c95be4bdaa54"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04177f637cc02f92ec0492d377528b2a"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a04177f637cc02f92ec0492d377528b2a">readline</a> (size_t size=65536, std::string eol=&quot;\n&quot;)</td></tr>
<tr class="separator:a04177f637cc02f92ec0492d377528b2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ff222081c30ee4343498c6cc5c14b10"><td class="memItemLeft" align="right" valign="top">std::vector&lt; std::string &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a2ff222081c30ee4343498c6cc5c14b10">readlines</a> (size_t size=65536, std::string eol=&quot;\n&quot;)</td></tr>
<tr class="separator:a2ff222081c30ee4343498c6cc5c14b10"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3275e8456850998c0ac46b2768ab9258"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a3275e8456850998c0ac46b2768ab9258">write</a> (const uint8_t *data, size_t size)</td></tr>
<tr class="separator:a3275e8456850998c0ac46b2768ab9258"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9c2827088d82ee82f245ffa106fa7d10"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a9c2827088d82ee82f245ffa106fa7d10">write</a> (const std::vector&lt; uint8_t &gt; &amp;data)</td></tr>
<tr class="separator:a9c2827088d82ee82f245ffa106fa7d10"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7c92c0307b86a935f6623953eec66460"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a7c92c0307b86a935f6623953eec66460">write</a> (const std::string &amp;data)</td></tr>
<tr class="separator:a7c92c0307b86a935f6623953eec66460"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a127104a1b211c46e4cad9002123e6ea8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a127104a1b211c46e4cad9002123e6ea8">setPort</a> (const std::string &amp;port)</td></tr>
<tr class="separator:a127104a1b211c46e4cad9002123e6ea8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a56eafe1694c92655d79993ce7139f0bf"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a56eafe1694c92655d79993ce7139f0bf">getPort</a> () const </td></tr>
<tr class="separator:a56eafe1694c92655d79993ce7139f0bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5b1a4e05b1690d29ba1ae14a9079434c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a5b1a4e05b1690d29ba1ae14a9079434c">setTimeout</a> (<a class="el" href="structserial_1_1_timeout.html">Timeout</a> &amp;timeout)</td></tr>
<tr class="separator:a5b1a4e05b1690d29ba1ae14a9079434c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4b4be39af3e1c68bc6ac09cb55788c86"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a4b4be39af3e1c68bc6ac09cb55788c86">setTimeout</a> (uint32_t inter_byte_timeout, uint32_t read_timeout_constant, uint32_t read_timeout_multiplier, uint32_t write_timeout_constant, uint32_t write_timeout_multiplier)</td></tr>
<tr class="separator:a4b4be39af3e1c68bc6ac09cb55788c86"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a13023f118c75b27fa2f0280d2d1c2a20"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structserial_1_1_timeout.html">Timeout</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a13023f118c75b27fa2f0280d2d1c2a20">getTimeout</a> () const </td></tr>
<tr class="separator:a13023f118c75b27fa2f0280d2d1c2a20"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a05085fc22adee665698bdfd9b7b9783f"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a05085fc22adee665698bdfd9b7b9783f">setBaudrate</a> (uint32_t baudrate)</td></tr>
<tr class="separator:a05085fc22adee665698bdfd9b7b9783f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7a6ca1f8d8e68742e95b7f8dc8e9a1fa"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a7a6ca1f8d8e68742e95b7f8dc8e9a1fa">getBaudrate</a> () const </td></tr>
<tr class="separator:a7a6ca1f8d8e68742e95b7f8dc8e9a1fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8adf3dcd68fb1b85ce30c8b443e5868a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a8adf3dcd68fb1b85ce30c8b443e5868a">setBytesize</a> (<a class="el" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a> bytesize)</td></tr>
<tr class="separator:a8adf3dcd68fb1b85ce30c8b443e5868a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac735ef88a54659e2d0b3ae674c5f0a41"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#ac735ef88a54659e2d0b3ae674c5f0a41">getBytesize</a> () const </td></tr>
<tr class="separator:ac735ef88a54659e2d0b3ae674c5f0a41"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af471db5d3a89128430e7e3c5389cd08a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#af471db5d3a89128430e7e3c5389cd08a">setParity</a> (<a class="el" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a> parity)</td></tr>
<tr class="separator:af471db5d3a89128430e7e3c5389cd08a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a80e5d87b1e93b4c5a9d6f2cc7110b3c4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a80e5d87b1e93b4c5a9d6f2cc7110b3c4">getParity</a> () const </td></tr>
<tr class="separator:a80e5d87b1e93b4c5a9d6f2cc7110b3c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0c690a31516cd11c521ba3aff4bafc4e"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a0c690a31516cd11c521ba3aff4bafc4e">setStopbits</a> (<a class="el" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a> stopbits)</td></tr>
<tr class="separator:a0c690a31516cd11c521ba3aff4bafc4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a81ee96ec2fdb80d1851430d9e2c4698b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a81ee96ec2fdb80d1851430d9e2c4698b">getStopbits</a> () const </td></tr>
<tr class="separator:a81ee96ec2fdb80d1851430d9e2c4698b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a76e56ce22e2706b8954a1dc9c5188c92"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a76e56ce22e2706b8954a1dc9c5188c92">setFlowcontrol</a> (<a class="el" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a> flowcontrol)</td></tr>
<tr class="separator:a76e56ce22e2706b8954a1dc9c5188c92"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad793526755625a59a0bf9d4cc0ea1755"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#ad793526755625a59a0bf9d4cc0ea1755">getFlowcontrol</a> () const </td></tr>
<tr class="separator:ad793526755625a59a0bf9d4cc0ea1755"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a45a7676a6e6c775cd549e889e714b5bb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a45a7676a6e6c775cd549e889e714b5bb">flush</a> ()</td></tr>
<tr class="separator:a45a7676a6e6c775cd549e889e714b5bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa7432cbada95a7eac6d71a107cf2eaa3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#aa7432cbada95a7eac6d71a107cf2eaa3">flushInput</a> ()</td></tr>
<tr class="separator:aa7432cbada95a7eac6d71a107cf2eaa3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95e0d6dcf2b7b9aa45225bfb1647c427"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a95e0d6dcf2b7b9aa45225bfb1647c427">flushOutput</a> ()</td></tr>
<tr class="separator:a95e0d6dcf2b7b9aa45225bfb1647c427"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab35e474beb136258cbeb04978be27455"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#ab35e474beb136258cbeb04978be27455">sendBreak</a> (int duration)</td></tr>
<tr class="separator:ab35e474beb136258cbeb04978be27455"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abb7eef9db06c582e2e504733b4150968"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#abb7eef9db06c582e2e504733b4150968">setBreak</a> (bool level=true)</td></tr>
<tr class="separator:abb7eef9db06c582e2e504733b4150968"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7c91f22768107389f52d80d691994fc7"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a7c91f22768107389f52d80d691994fc7">setRTS</a> (bool level=true)</td></tr>
<tr class="separator:a7c91f22768107389f52d80d691994fc7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4c8a44a1e6ce42f8cb521d9a4e10bc59"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a4c8a44a1e6ce42f8cb521d9a4e10bc59">setDTR</a> (bool level=true)</td></tr>
<tr class="separator:a4c8a44a1e6ce42f8cb521d9a4e10bc59"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9d889dc0ec2cec50a620650f10cf8e83"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a9d889dc0ec2cec50a620650f10cf8e83">waitForChange</a> ()</td></tr>
<tr class="separator:a9d889dc0ec2cec50a620650f10cf8e83"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97603438c9ded81a886f914b7a335d7f"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a97603438c9ded81a886f914b7a335d7f">getCTS</a> ()</td></tr>
<tr class="separator:a97603438c9ded81a886f914b7a335d7f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a91a00816bce6a163ea022b4cf8d4ce0e"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a91a00816bce6a163ea022b4cf8d4ce0e">getDSR</a> ()</td></tr>
<tr class="separator:a91a00816bce6a163ea022b4cf8d4ce0e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a29a1f68b9a238e9a6a833373855708ce"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a29a1f68b9a238e9a6a833373855708ce">getRI</a> ()</td></tr>
<tr class="separator:a29a1f68b9a238e9a6a833373855708ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5a7c1a8e363b530147970155d0f6fe8d"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#a5a7c1a8e363b530147970155d0f6fe8d">getCD</a> ()</td></tr>
<tr class="separator:a5a7c1a8e363b530147970155d0f6fe8d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acb2866093a60772d13691c99bd91adc6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classserial_1_1_serial.html#acb2866093a60772d13691c99bd91adc6">getByteTime</a> ()</td></tr>
<tr class="separator:acb2866093a60772d13691c99bd91adc6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Class that provides a portable serial port interface. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="aecbc4cc1723143805ae5a4aa79ba9332"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">serial::Serial::Serial </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>port</em> = <code>&quot;&quot;</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>baudrate</em> = <code>9600</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structserial_1_1_timeout.html">Timeout</a>&#160;</td>
          <td class="paramname"><em>timeout</em> = <code><a class="el" href="structserial_1_1_timeout.html">Timeout</a>()</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a>&#160;</td>
          <td class="paramname"><em>bytesize</em> = <code>eightbits</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a>&#160;</td>
          <td class="paramname"><em>parity</em> = <code>parity_none</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a>&#160;</td>
          <td class="paramname"><em>stopbits</em> = <code>stopbits_one</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a>&#160;</td>
          <td class="paramname"><em>flowcontrol</em> = <code>flowcontrol_none</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Creates a <a class="el" href="classserial_1_1_serial.html">Serial</a> object and opens the port if a port is specified, otherwise it remains closed until <a class="el" href="classserial_1_1_serial.html#aa4403ddb51e9d209fd86ed316f0ee9b4">serial::Serial::open</a> is called.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">port</td><td>A std::string containing the address of the serial port, which would be something like 'COM1' on Windows and '/dev/ttyS0' on Linux.</td></tr>
    <tr><td class="paramname">baudrate</td><td>An unsigned 32-bit integer that represents the baudrate</td></tr>
    <tr><td class="paramname">timeout</td><td>A <a class="el" href="structserial_1_1_timeout.html">serial::Timeout</a> struct that defines the timeout conditions for the serial port. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="structserial_1_1_timeout.html">serial::Timeout</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">bytesize</td><td>Size of each byte in the serial transmission of data, default is eightbits, possible values are: fivebits, sixbits, sevenbits, eightbits</td></tr>
    <tr><td class="paramname">parity</td><td>Method of parity, default is parity_none, possible values are: parity_none, parity_odd, parity_even</td></tr>
    <tr><td class="paramname">stopbits</td><td>Number of stop bits used, default is stopbits_one, possible values are: stopbits_one, stopbits_one_point_five, stopbits_two</td></tr>
    <tr><td class="paramname">flowcontrol</td><td>Type of flowcontrol used, default is flowcontrol_none, possible values are: flowcontrol_none, flowcontrol_software, flowcontrol_hardware</td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">serial::PortNotOpenedException</td><td></td></tr>
    <tr><td class="paramname">serial::IOException</td><td></td></tr>
    <tr><td class="paramname">std::invalid_argument</td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a071000a2f5f77a40df8311fad5044481"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">serial::Serial::~Serial </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Destructor </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ab5fae6cebb8e34345ca1f55cbccc4698"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t serial::Serial::available </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Return the number of characters in the buffer. </p>

</div>
</div>
<a class="anchor" id="afb659db0159a6f4bcefe760fa20df18e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void serial::Serial::closePort </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Closes the serial port. </p>

</div>
</div>
<a class="anchor" id="a45a7676a6e6c775cd549e889e714b5bb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void serial::Serial::flush </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Flush the input and output buffers </p>

</div>
</div>
<a class="anchor" id="aa7432cbada95a7eac6d71a107cf2eaa3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void serial::Serial::flushInput </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Flush only the input buffer </p>

</div>
</div>
<a class="anchor" id="a95e0d6dcf2b7b9aa45225bfb1647c427"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void serial::Serial::flushOutput </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Flush only the output buffer </p>

</div>
</div>
<a class="anchor" id="a7a6ca1f8d8e68742e95b7f8dc8e9a1fa"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t serial::Serial::getBaudrate </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the baudrate for the serial port.</p>
<dl class="section return"><dt>Returns</dt><dd>An integer that sets the baud rate for the serial port.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classserial_1_1_serial.html#a05085fc22adee665698bdfd9b7b9783f">Serial::setBaudrate</a></dd></dl>
<p>\ </p>

</div>
</div>
<a class="anchor" id="ac735ef88a54659e2d0b3ae674c5f0a41"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a> serial::Serial::getBytesize </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the bytesize for the serial port.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classserial_1_1_serial.html#a8adf3dcd68fb1b85ce30c8b443e5868a">Serial::setBytesize</a></dd></dl>
<p>\ </p>

</div>
</div>
<a class="anchor" id="acb2866093a60772d13691c99bd91adc6"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int serial::Serial::getByteTime </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the singal byte time. </p>

</div>
</div>
<a class="anchor" id="a5a7c1a8e363b530147970155d0f6fe8d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::getCD </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the current status of the CD line. </p>

</div>
</div>
<a class="anchor" id="a97603438c9ded81a886f914b7a335d7f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::getCTS </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the current status of the CTS line. </p>

</div>
</div>
<a class="anchor" id="a91a00816bce6a163ea022b4cf8d4ce0e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::getDSR </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the current status of the DSR line. </p>

</div>
</div>
<a class="anchor" id="ad793526755625a59a0bf9d4cc0ea1755"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a> serial::Serial::getFlowcontrol </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the flow control for the serial port.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classserial_1_1_serial.html#a76e56ce22e2706b8954a1dc9c5188c92">Serial::setFlowcontrol</a></dd></dl>
<p>\ </p>

</div>
</div>
<a class="anchor" id="a80e5d87b1e93b4c5a9d6f2cc7110b3c4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a> serial::Serial::getParity </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the parity for the serial port.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classserial_1_1_serial.html#af471db5d3a89128430e7e3c5389cd08a">Serial::setParity</a></dd></dl>
<p>\ </p>

</div>
</div>
<a class="anchor" id="a56eafe1694c92655d79993ce7139f0bf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">string serial::Serial::getPort </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the serial port identifier.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classserial_1_1_serial.html#a127104a1b211c46e4cad9002123e6ea8">Serial::setPort</a></dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::invalid_argument</td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a29a1f68b9a238e9a6a833373855708ce"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::getRI </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns the current status of the RI line. </p>

</div>
</div>
<a class="anchor" id="a81ee96ec2fdb80d1851430d9e2c4698b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a> serial::Serial::getStopbits </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the stopbits for the serial port.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classserial_1_1_serial.html#a0c690a31516cd11c521ba3aff4bafc4e">Serial::setStopbits</a></dd></dl>
<p>\ </p>

</div>
</div>
<a class="anchor" id="a13023f118c75b27fa2f0280d2d1c2a20"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structserial_1_1_timeout.html">serial::Timeout</a> serial::Serial::getTimeout </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the timeout for reads in seconds.</p>
<dl class="section return"><dt>Returns</dt><dd>A <a class="el" href="structserial_1_1_timeout.html">Timeout</a> struct containing the inter_byte_timeout, and read and write timeout constants and multipliers.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classserial_1_1_serial.html#a5b1a4e05b1690d29ba1ae14a9079434c">Serial::setTimeout</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a657df1809f2eb966aec5811ed2c70b8c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::isOpen </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Gets the open status of the serial port.</p>
<dl class="section return"><dt>Returns</dt><dd>Returns true if the port is open, false otherwise. </dd></dl>

</div>
</div>
<a class="anchor" id="aa4403ddb51e9d209fd86ed316f0ee9b4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::open </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Opens the serial port as long as the port is set and the port isn't already open.</p>
<p>If the port is provided to the constructor then an explicit call to open is not needed.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classserial_1_1_serial.html#aecbc4cc1723143805ae5a4aa79ba9332">Serial::Serial</a> </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>Returns true if the port is open, false otherwise. </dd></dl>

</div>
</div>
<a class="anchor" id="a01fc2e3d77cb7d70069de87eca1400e9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t serial::Serial::read </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Read a given amount of bytes from the serial port into a given buffer.</p>
<p>The read function will return in one of three cases:</p><ul>
<li>The number of requested bytes was read.<ul>
<li>In this case the number of bytes requested will match the size_t returned by read.</li>
</ul>
</li>
<li>A timeout occurred, in this case the number of bytes read will not match the amount requested, but no exception will be thrown. One of two possible timeouts occurred:<ul>
<li>The inter byte timeout expired, this means that number of milliseconds elapsed between receiving bytes from the serial port exceeded the inter byte timeout.</li>
<li>The total timeout expired, which is calculated by multiplying the read timeout multiplier by the number of requested bytes and then added to the read timeout constant. If that total number of milliseconds elapses after the initial call to read a timeout will occur.</li>
</ul>
</li>
<li>An exception occurred, in this case an actual exception will be thrown.</li>
</ul>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>An uint8_t array of at least the requested size. </td></tr>
    <tr><td class="paramname">size</td><td>A size_t defining how many bytes to be read.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A size_t representing the number of bytes read as a result of the call to read. </dd></dl>

</div>
</div>
<a class="anchor" id="a3ecd4645c76548ba079eab6f2f46adfb"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t serial::Serial::read </td>
          <td>(</td>
          <td class="paramtype">std::vector&lt; uint8_t &gt; &amp;&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em> = <code>1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Read a given amount of bytes from the serial port into a give buffer.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>A reference to a std::vector of uint8_t. </td></tr>
    <tr><td class="paramname">size</td><td>A size_t defining how many bytes to be read.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A size_t representing the number of bytes read as a result of the call to read. </dd></dl>

</div>
</div>
<a class="anchor" id="ad6c6637fdf8edd85c3a6a63d98fc18f7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t serial::Serial::read </td>
          <td>(</td>
          <td class="paramtype">std::string &amp;&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em> = <code>1</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Read a given amount of bytes from the serial port into a give buffer.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>A reference to a std::string. </td></tr>
    <tr><td class="paramname">size</td><td>A size_t defining how many bytes to be read.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A size_t representing the number of bytes read as a result of the call to read. </dd></dl>

</div>
</div>
<a class="anchor" id="aa52fbf7d23fb761a46e2400829d2b77a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">string serial::Serial::read </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em> = <code>1</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Read a given amount of bytes from the serial port and return a string containing the data.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">size</td><td>A size_t defining how many bytes to be read.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A std::string containing the data read from the port. </dd></dl>

</div>
</div>
<a class="anchor" id="a23af62642b1739cf31fb1c8a272074a1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t serial::Serial::readData </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>readData </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td></td></tr>
    <tr><td class="paramname">size</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd></dd></dl>

</div>
</div>
<a class="anchor" id="a010b18ec545dfe1a7bb1c95be4bdaa54"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t serial::Serial::readline </td>
          <td>(</td>
          <td class="paramtype">std::string &amp;&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em> = <code>65536</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::string&#160;</td>
          <td class="paramname"><em>eol</em> = <code>&quot;\n&quot;</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Reads in a line or until a given delimiter has been processed.</p>
<p>Reads from the serial port until a single line has been read.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buffer</td><td>A std::string reference used to store the data. </td></tr>
    <tr><td class="paramname">size</td><td>A maximum length of a line, defaults to 65536 (2^16) </td></tr>
    <tr><td class="paramname">eol</td><td>A string to match against for the EOL.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A size_t representing the number of bytes read. </dd></dl>

</div>
</div>
<a class="anchor" id="a04177f637cc02f92ec0492d377528b2a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::string serial::Serial::readline </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em> = <code>65536</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::string&#160;</td>
          <td class="paramname"><em>eol</em> = <code>&quot;\n&quot;</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Reads in a line or until a given delimiter has been processed.</p>
<p>Reads from the serial port until a single line has been read.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">size</td><td>A maximum length of a line, defaults to 65536 (2^16) </td></tr>
    <tr><td class="paramname">eol</td><td>A string to match against for the EOL.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A std::string containing the line. </dd></dl>

</div>
</div>
<a class="anchor" id="a2ff222081c30ee4343498c6cc5c14b10"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vector&lt; string &gt; serial::Serial::readlines </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em> = <code>65536</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::string&#160;</td>
          <td class="paramname"><em>eol</em> = <code>&quot;\n&quot;</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Reads in multiple lines until the serial port times out.</p>
<p>This requires a timeout &gt; 0 before it can be run. It will read until a timeout occurs and return a list of strings.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">size</td><td>A maximum length of combined lines, defaults to 65536 (2^16)</td></tr>
    <tr><td class="paramname">eol</td><td>A string to match against for the EOL.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A vector&lt;string&gt; containing the lines. </dd></dl>

</div>
</div>
<a class="anchor" id="ab35e474beb136258cbeb04978be27455"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void serial::Serial::sendBreak </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>duration</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sends the RS-232 break signal. See tcsendbreak(3). </p>

</div>
</div>
<a class="anchor" id="a05085fc22adee665698bdfd9b7b9783f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::setBaudrate </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>baudrate</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sets the baudrate for the serial port.</p>
<p>Possible baudrates depends on the system but some safe baudrates include: 110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 56000, 57600, 115200 Some other baudrates that are supported by some comports: 128000, 153600, 230400, 256000, 460800, 921600</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">baudrate</td><td>An integer that sets the baud rate for the serial port. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="abb7eef9db06c582e2e504733b4150968"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::setBreak </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>level</em> = <code>true</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set the break condition to a given level. Defaults to true. </p>

</div>
</div>
<a class="anchor" id="a8adf3dcd68fb1b85ce30c8b443e5868a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::setBytesize </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceserial.html#a00b3281fa11cea770c0b0c8a106080f8">bytesize_t</a>&#160;</td>
          <td class="paramname"><em>bytesize</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sets the bytesize for the serial port.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">bytesize</td><td>Size of each byte in the serial transmission of data, default is eightbits, possible values are: fivebits, sixbits, sevenbits, eightbits</td></tr>
  </table>
  </dd>
</dl>
<p>\ </p>

</div>
</div>
<a class="anchor" id="a4c8a44a1e6ce42f8cb521d9a4e10bc59"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::setDTR </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>level</em> = <code>true</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set the DTR handshaking line to the given level. Defaults to true. </p>

</div>
</div>
<a class="anchor" id="a76e56ce22e2706b8954a1dc9c5188c92"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::setFlowcontrol </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceserial.html#a93ef57a314b4e562f9eded6c15d34351">flowcontrol_t</a>&#160;</td>
          <td class="paramname"><em>flowcontrol</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sets the flow control for the serial port.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">flowcontrol</td><td>Type of flowcontrol used, default is flowcontrol_none, possible values are: flowcontrol_none, flowcontrol_software, flowcontrol_hardware</td></tr>
  </table>
  </dd>
</dl>
<p>\ </p>

</div>
</div>
<a class="anchor" id="af471db5d3a89128430e7e3c5389cd08a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::setParity </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceserial.html#a8f45d26bf7c9a06659e75b5004a50481">parity_t</a>&#160;</td>
          <td class="paramname"><em>parity</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sets the parity for the serial port.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">parity</td><td>Method of parity, default is parity_none, possible values are: parity_none, parity_odd, parity_even</td></tr>
  </table>
  </dd>
</dl>
<p>\ </p>

</div>
</div>
<a class="anchor" id="a127104a1b211c46e4cad9002123e6ea8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void serial::Serial::setPort </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>port</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sets the serial port identifier.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">port</td><td>A const std::string reference containing the address of the serial port, which would be something like 'COM1' on Windows and '/dev/ttyS0' on Linux.</td></tr>
  </table>
  </dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">std::invalid_argument</td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a7c91f22768107389f52d80d691994fc7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::setRTS </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>level</em> = <code>true</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Set the RTS handshaking line to the given level. Defaults to true. </p>

</div>
</div>
<a class="anchor" id="a0c690a31516cd11c521ba3aff4bafc4e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::setStopbits </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceserial.html#af5b116611d6628a3aa8f788fdc09f469">stopbits_t</a>&#160;</td>
          <td class="paramname"><em>stopbits</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sets the stopbits for the serial port.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stopbits</td><td>Number of stop bits used, default is stopbits_one, possible values are: stopbits_one, stopbits_one_point_five, stopbits_two</td></tr>
  </table>
  </dd>
</dl>
<p>\ </p>

</div>
</div>
<a class="anchor" id="a5b1a4e05b1690d29ba1ae14a9079434c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void serial::Serial::setTimeout </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structserial_1_1_timeout.html">serial::Timeout</a> &amp;&#160;</td>
          <td class="paramname"><em>timeout</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sets the timeout for reads and writes using the <a class="el" href="structserial_1_1_timeout.html">Timeout</a> struct.</p>
<p>There are two timeout conditions described here:</p><ul>
<li>The inter byte timeout:<ul>
<li>The inter_byte_timeout component of <a class="el" href="structserial_1_1_timeout.html">serial::Timeout</a> defines the maximum amount of time, in milliseconds, between receiving bytes on the serial port that can pass before a timeout occurs. Setting this to zero will prevent inter byte timeouts from occurring.</li>
</ul>
</li>
<li>Total time timeout:<ul>
<li>The constant and multiplier component of this timeout condition, for both read and write, are defined in <a class="el" href="structserial_1_1_timeout.html">serial::Timeout</a>. This timeout occurs if the total time since the read or write call was made exceeds the specified time in milliseconds.</li>
<li>The limit is defined by multiplying the multiplier component by the number of requested bytes and adding that product to the constant component. In this way if you want a read call, for example, to timeout after exactly one second regardless of the number of bytes you asked for then set the read_timeout_constant component of <a class="el" href="structserial_1_1_timeout.html">serial::Timeout</a> to 1000 and the read_timeout_multiplier to zero. This timeout condition can be used in conjunction with the inter byte timeout condition with out any problems, timeout will simply occur when one of the two timeout conditions is met. This allows users to have maximum control over the trade-off between responsiveness and efficiency.</li>
</ul>
</li>
</ul>
<p>Read and write functions will return in one of three cases. When the reading or writing is complete, when a timeout occurs, or when an exception occurs.</p>
<p>A timeout of 0 enables non-blocking mode.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timeout</td><td>A <a class="el" href="structserial_1_1_timeout.html">serial::Timeout</a> struct containing the inter byte timeout, and the read and write timeout constants and multipliers.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="structserial_1_1_timeout.html">serial::Timeout</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a4b4be39af3e1c68bc6ac09cb55788c86"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void serial::Serial::setTimeout </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>inter_byte_timeout</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>read_timeout_constant</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>read_timeout_multiplier</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>write_timeout_constant</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>write_timeout_multiplier</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Sets the timeout for reads and writes. </p>

</div>
</div>
<a class="anchor" id="a35c0f6ff20c142a5210dde288731f954"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void serial::Serial::waitByteTimes </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>count</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Block for a period of time corresponding to the transmission time of count characters at present serial settings. This may be used in con- junction with waitReadable to read larger blocks of data from the port. </p>

</div>
</div>
<a class="anchor" id="a9d889dc0ec2cec50a620650f10cf8e83"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::waitForChange </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Blocks until CTS, DSR, RI, CD changes or something interrupts it.</p>
<p>Can throw an exception if an error occurs while waiting. You can check the status of CTS, DSR, RI, and CD once this returns. Uses TIOCMIWAIT via ioctl if available (mostly only on Linux) with a resolution of less than +-1ms and as good as +-0.2ms. Otherwise a polling method is used which can give +-2ms.</p>
<dl class="section return"><dt>Returns</dt><dd>Returns true if one of the lines changed, false if something else occurred. </dd></dl>

</div>
</div>
<a class="anchor" id="aa94e4ca3b2b803e3145c99fe063ae09b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int serial::Serial::waitfordata </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>data_count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>timeout</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>returned_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>waitfordata </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data_count</td><td></td></tr>
    <tr><td class="paramname">timeout</td><td></td></tr>
    <tr><td class="paramname">returned_size</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd></dd></dl>

</div>
</div>
<a class="anchor" id="a59bd8d40309769e8eed91dd3684e0000"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool serial::Serial::waitReadable </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Block until there is serial data to read or read_timeout_constant number of milliseconds have elapsed. The return value is true when the function exits with the port in a readable state, false otherwise (due to timeout or select interruption). </p>

</div>
</div>
<a class="anchor" id="a3275e8456850998c0ac46b2768ab9258"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t serial::Serial::write </td>
          <td>(</td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Write a string to the serial port.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>A const reference containing the data to be written to the serial port.</td></tr>
    <tr><td class="paramname">size</td><td>A size_t that indicates how many bytes should be written from the given data buffer.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A size_t representing the number of bytes actually written to the serial port.</dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
  <table class="exception">
    <tr><td class="paramname">serial::PortNotOpenedException</td><td></td></tr>
    <tr><td class="paramname">serial::SerialException</td><td></td></tr>
    <tr><td class="paramname">serial::IOException</td><td></td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a9c2827088d82ee82f245ffa106fa7d10"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t serial::Serial::write </td>
          <td>(</td>
          <td class="paramtype">const std::vector&lt; uint8_t &gt; &amp;&#160;</td>
          <td class="paramname"><em>data</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Write a string to the serial port.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>A const reference containing the data to be written to the serial port.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A size_t representing the number of bytes actually written to the serial port. </dd></dl>

</div>
</div>
<a class="anchor" id="a7c92c0307b86a935f6623953eec66460"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">size_t serial::Serial::write </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>data</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Write a string to the serial port.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>A const reference containing the data to be written to the serial port.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A size_t representing the number of bytes actually written to the serial port. </dd></dl>

</div>
</div>
<a class="anchor" id="aeb637cc63ead4662317cea58a997e0f6"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">size_t serial::Serial::writeData </td>
          <td>(</td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>writeData </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td></td></tr>
    <tr><td class="paramname">size</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd></dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/home/yang/lidar_ws/src/sdk/include/<a class="el" href="serial_8h_source.html">serial.h</a></li>
<li>/home/yang/lidar_ws/src/sdk/src/serial.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
